package org.example.controller;

import io.seata.spring.annotation.GlobalTransactional;
import org.example.util.Result;
import org.example.feign.TypeFeign;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/typeFeign")
public class TypeFeignController {
    @Resource
    private TypeFeign typeFeign;
    @GlobalTransactional
    @GetMapping("/updateNum")
    public Result updateNum(@RequestParam("tid") Integer tid, @RequestParam("num") Integer num){
        return Result.OK(typeFeign.updateNum(tid, num));
    }
    @GetMapping("/selectId")
    public Result selectId(Integer tid){
        return Result.OK( typeFeign.selectId(tid));
    }
}
